package com.builder;
import java.util.Date;

/**
 * Created by CrazyShaQiuShi on 2017/1/22.
 */
public class Person {
    private String name;
    private Integer age;
    private Date birth;
    private boolean isGraphicsCardEnabled;

    public String getName() {
        return name;
    }

    public Integer getAge() {
        return age;
    }

    public Date getBirth() {
        return birth;
    }

    public boolean isGraphicsCardEnabled() {
        return isGraphicsCardEnabled;
    }

    private Person(PersonBuilder builder) {
        this.name = builder.name;
        this.age = builder.age;
        this.birth = builder.birth;
        this.isGraphicsCardEnabled = builder.isGraphicsCardEnabled;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", birth=" + birth +
                ", isGraphicsCardEnabled=" + isGraphicsCardEnabled +
                '}';
    }

    public static class PersonBuilder {
        private String name;
        private Integer age;
        private Date birth;
        private boolean isGraphicsCardEnabled;

        public PersonBuilder(String name, Integer age,Date birth) {
            this.age = age;
            this.name = name;
            this.birth=birth;
        }

        public PersonBuilder setGraphicsCardEnabled(boolean isGraphicsCardEnabled) {
            this.isGraphicsCardEnabled = isGraphicsCardEnabled;
            return this;
        }

        public Person build(){
            return new Person(this);
        }

    }
}